package day05_api.com.itheima.d3_method_reference;

import java.util.Arrays;

public class Test1 {
    public static void main(String[] args) {

        // 目标：理解静态方法引用。
        Student[] students = new Student[4]; // students = [null, null, null, null]
        students[0] = new Student("周芷若", 21, '女', 169.3);
        students[1] = new Student("殷素素", 38, '女', 172.2);
        students[2] = new Student("小昭", 19, '女', 168.5);
        students[3] = new Student("张无忌", 23, '男', 183.5);

//        Arrays.sort( students, (o1, o2) -> Double.compare(o1.getHeight(),o2.getHeight()));
//        Arrays.sort(students, (o1, o2) -> Student.compareByHeight(o1,o2));
        Arrays.sort(students, Student::compareByHeight);

        System.out.println("Arrays.toString(students) = " + Arrays.toString(students));
    }

}
